﻿@page "/DataSource/MQTTConfig"
<PageTitle>@PageName</PageTitle>
@inherits ComponentBaseDataCenter
<div>

<h3>@PageName</h3>

<Table TItem="MQTTConfigVO" UseInjectDataService="false" IsPagination="true" PageItemsSource="PageItems" DoubleClickToEdit="true"
       IsStriped="true" IsBordered="true" ShowSkeleton="true" IsMultipleSelect="true" ShowEmpty="true" ShowLoading="true" ShowColumnList="true"
       ShowToolbar="true" ShowExtendButtons="true"
       ShowSearch="true" ShowAdvancedSearch="false"
       AutoGenerateColumns="true" EditMode="EditMode.Popup"
       OnQueryAsync="QueryAsync" OnSaveAsync="@OnSaveAsync" OnDeleteAsync="OnDeleteAsync" ShowToastAfterSaveOrDeleteModel="false">
    @*<TableToolbarTemplate>
        <TableToolbarButton TItem="MQTTConfigVO" Icon="fa-fw fa-solid fa-pen-to-square" IsEnableWhenSelectedOneRow="true" Text="测试" Color="Color.Primary" />
    </TableToolbarTemplate>*@
    <EditTemplate>
        <div class="row g-3 form-inline">
            <div class="col-12 col-sm-6">
                <BootstrapInput @bind-Value="@context.Name" placeholder="不可为空，50字以内" maxlength="50" />
            </div>
            <div class="col-12 col-sm-6">
                <BootstrapInput @bind-Value="@context.ClientID" placeholder="不可为空，50字以内" maxlength="50"  />
            </div>
            @*<div class="col-12 col-sm-6">
            <Select @bind-Value="@context.type" placeholder="不可为空，50字以内" />
            </div>*@
            <div class="col-12 col-sm-6">
                <BootstrapInput @bind-Value="@context.BrokerAddress" placeholder="请输入服务器IP" maxlength="50" />
            </div>
            <div class="col-12 col-sm-6">
                <BootstrapInputNumber @bind-Value="@context.BrokerPort" placeholder="请输入服务器端口号" />
            </div>
            <div class="col-12 col-sm-6">
                <BootstrapInput @bind-Value="@context.UserName"  />
            </div>
            <div class="col-12 col-sm-6">
                <BootstrapInput @bind-Value="@context.Password" />
            </div>
        </div>
    </EditTemplate>
    <RowButtonTemplate>
        <TableCellButton Color="Color.Info" Icon="fa-solid fa-pen" Text="测试连接" OnClick="@(()=>OnConnTestAsync(context))" />
        @*<TableCellPopconfirmButton Color="Color.Info" Icon="fa-solid fa-pen" Text="测试" />*@
    </RowButtonTemplate>
    @*<TableColumns>
    <TableColumn @bind-Field="@context.Hobby" Items="GetHobbys(context)" />
    </TableColumns>*@
</Table>
</div>
